import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);//路由
import $ from 'jquery';
import home from "./conponents/tabbar/home.vue";//首页
import supermarket from './conponents/tabbar/home/supermarket.vue';//超市
import seach from "./conponents/tabbar/seach.vue";//搜索
import contact from "./conponents/tabbar/contact.vue";//用户
import register from "./conponents/tabbar/contact/register.vue";//注册页面
import log from "./conponents/tabbar/contact/log.vue";//登录页面
import plus from "./conponents/tabbar/plus.vue";//购物车
import news from "./conponents/tabbar/home/news.vue";//新闻
import news_zx from "./conponents/tabbar/home/new/news-zx.vue";//新闻
import 'bootstrap/dist/css/bootstrap.css';//bootstrap.cSS的地址
// import comment from "./conponents/tabbar/home/new/comment.vue";//评论
import particulars from './conponents/tabbar/home/supermarket/particulars.vue';//详情
import introduce from "./conponents/tabbar/home/supermarket/introduce.vue";//图文展示
Vue.config.keyCodes.Enter=13;
Vue.filter("dataFormat",function (input) {
    //定义全局过滤器
    var a= new Date(input);
    var y = a.getFullYear().toString();//年
    var m = (a.getMonth()+1).toString();//月
    var d = a.getDate().toString();//日
    var h=a.getHours().toString();
    var f=a.getMinutes().toString();
    var s=a.getSeconds().toString();
    var str1=`${y}-${m.padStart(2,0)}-${d.padStart(2,0)} ${h.padStart(2,0)}:${f.padStart(2,0)}:${s.padStart(2,0)}`;//连接字符串
    return str1;
});
var router = new VueRouter({
    routes:[
        {path:'/',redirect:"/home"},//重定到这个地址
        {path:'/home',component:home},
        {path:'/supermarket', component:supermarket },
        {path:'/seach',component:seach},
        {path:'/contact',component:contact},
        {path:'/plus',component:plus},
        {path:'/particulars/:id',component:particulars,name:"particulars"},
        {path:'/introduce/:id',component:introduce,name:"introduce"},//图文展示
        {path:'/register',component:register},
        {path:'/log',component:log},
        {path:'/news',component:news},
        {path:'/news_zx/:id',component:news_zx},
        // {path:'/comment' , component:comment,name:'comment'}
    ],
    linkActiveClass:'mui-active',
});
export  default router;